﻿#pragma once

#include "BtnST.h"
#include "public\\cdib.h"
#ifndef SOCKET_MSG
#include "CCbSocket.h"
#endif

// CBottomWnd 窗体视图
class CMainFrame;
class CBottomWnd : public CFormView
{
	DECLARE_DYNCREATE(CBottomWnd)

public:
	CBottomWnd();           // 动态创建所使用的受保护的构造函数 
	virtual ~CBottomWnd();
	CMainFrame*  m_pParent;

public:
#ifdef AFX_DESIGN_TIME
	enum { IDD = IDD_CBottomWnd };
#endif
#ifdef _DEBUG
	virtual void AssertValid() const;
#ifndef _WIN32_WCE
	virtual void Dump(CDumpContext& dc) const;
#endif
#endif

private:
	CButtonST m_btRT;
	CButtonST m_btHQ;
	CButtonST m_btMS;
	CButtonST m_btMC;
	CButtonST m_btSys;
	CButtonST m_bexit;
	CButtonST m_block;

	CDib	m_dibFid1;				//FID1 点火状态
	CDib	m_dibFid2;				//FID2 点火状态
	CDib	m_dibFid3;				//FID3 点火状态
	CDib	m_dibEPC;				//EPC 通信状态
	CDib	m_dibWitsIn;			//WITSIN 状态
	CDib	m_dibWitsOut;			//WITSOUT 状态

	int		m_nTimer;
	CRect   m_rtUpdate[6];
	int		m_nOldStatus[6];
	CString		m_strOldMsg;
	int			m_nErrorLast;		//错误延续的时间
	int			m_nZeroFidLast;		//FID熄火时长
	int			m_nFirNum;			//点火失败时长
	bool		m_bUpdateBottom;	//是否进行了底部刷新
	bool		m_lock_status;		//锁定状态
#ifdef DEMO
	int		m_nDemoTimer;		//测试定时器
	Chrom_File  cfDemo;
#endif
private:
	void	Draw(CDC* pDC);

public:
	void	ConnectQCBoard(bool bMsg);
	CMyThreadSafeTimeout timeout;

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持

	DECLARE_MESSAGE_MAP()
public:
	virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
	virtual void OnDraw(CDC* pSDC);

	virtual void OnInitialUpdate();
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnBnClickedBtrt();
	afx_msg void OnBnClickedBthq();
	afx_msg void OnBnClickedBtms();
	afx_msg void OnBnClickedBtmc();
	afx_msg void OnBnClickedBtsystem();
	afx_msg void OnTimer(UINT_PTR nIDEvent);
	afx_msg void OnBnClickedLock();
	afx_msg void OnBnClickedExit();
};


extern CBottomWnd* bot_dlg;